<?php
/**
 * 玩法模型类
 *
 *
 *
 *
 * @copyright  Copyright (c) 2014-2015 TuntronKJ Inc. (http://www.tuntron.com)
 * @license    http://www.tuntron.com
 * @link       http://www.tuntron.com
 * @since      File available since Release v1.1
 */
defined('InTuntronKJ') or exit('Access Invalid!');

class playedModel extends Model{
	
	public function __construct() {
		parent::__construct('played_group');
	}
	
	/**
	 * 读取一条玩法组信息
	 *
	 * @param string $type 类型ID
	 * @return array 数组格式的返回结果
	 */
	public function getGroupType($groupId){
		$param	= array();
		$param['table']	= 'played_group';
		$param['where']	= "id='".$groupId."'";
		return Db::select($param);
	}
	
	/**
	 * 获取玩法组列表
	 * @param unknown $condition
	 * @param string $field
	 * @param number $page
	 * @param number $limit
	 * @param string $order
	 */
	public function getGroupList($condition = array(), $field = '*', $page = 0, $limit = 0,$order = 'sort asc'){
		return $this->where($condition)->limit($limit)->page($page)->order($order)->select();
	}
	
	
	/**
	 * 获取玩法列表
	 * @param unknown $condition
	 * @param string $field
	 * @param number $page
	 * @param number $limit
	 * @param string $order
	 */
	public function getPlayList($condition = array(), $field = '*', $page = 0, $limit = 0,$order = 'id asc'){
		return $this->table('played')->where($condition)->limit($limit)->page($page)->order($order)->select();
	}
	
	/**
	 * 读取玩法信息
	 * @param unknown $condition
	 * @param string $field
	 */
	public function getPlayInfo($condition, $field = '*'){
		return $this->table('played')->field($field)->where($condition)->find();
	}

}